import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '@/views/Layout'

Vue.use(VueRouter)
// 可以通过 this.$router.options.routes
const routes = [
  {
    path: '/',
    redirect: '/layout'
  },
  {
    path: '/layout',
    component: Layout,
    children: [{
      path: 'home',
      component: () => import('@/views/Home'),
      meta: {
        title: '首页'
      }
    },
    {
      path: 'search',
      component: () => import('@/views/Search'),
      meta: {
        title: '搜索'
      }
    },
    {
      path: 'play',
      component: () => import('@/views/Play')
    }]
  }

]

const router = new VueRouter({
  routes
})

export default router
